-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[TargetLoweringObjectFile] Handle riscv BE #155166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-backend-risc-v Author: Djordje Todorovic (djtodoro) ChangesAdd DWARF exception handling support for riscv big-endian targets. Full diff: https://github.com/llvm/llvm-project/pull/155166.diff 2 Files Affected:
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index d19ef923ef740..739dcc7f4c868 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -247,6 +247,8 @@ void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
break;
case Triple::riscv32:
case Triple::riscv64:
+ case Triple::riscv32be:
+ case Triple::riscv64be:
LSDAEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
dwarf::DW_EH_PE_sdata4;
diff --git a/llvm/test/CodeGen/RISCV/dwarf-eh.ll b/llvm/test/CodeGen/RISCV/dwarf-eh.ll
index 39cc0d52c9fe1..dd9e9e59206ac 100644
--- a/llvm/test/CodeGen/RISCV/dwarf-eh.ll
+++ b/llvm/test/CodeGen/RISCV/dwarf-eh.ll
@@ -14,6 +14,22 @@
; RUN: | FileCheck %s
; RUN: llc -mtriple=riscv64 --code-model=medium -relocation-model=pic < %s \
; RUN: | FileCheck %s
+; RUN: llc -mtriple=riscv32be --code-model=small < %s \
+; RUN: | FileCheck %s
+; RUN: llc -mtriple=riscv32be --code-model=medium < %s \
+; RUN: | FileCheck %s
+; RUN: llc -mtriple=riscv32be --code-model=small -relocation-model=pic < %s \
+; RUN: | FileCheck %s
+; RUN: llc -mtriple=riscv32be --code-model=medium -relocation-model=pic < %s \
+; RUN: | FileCheck %s
+; RUN: llc -mtriple=riscv64be --code-model=small < %s \
+; RUN: | FileCheck %s
+; RUN: llc -mtriple=riscv64be --code-model=medium < %s \
+; RUN: | FileCheck %s
+; RUN: llc -mtriple=riscv64be --code-model=small -relocation-model=pic < %s \
+; RUN: | FileCheck %s
+; RUN: llc -mtriple=riscv64be --code-model=medium -relocation-model=pic < %s \
+; RUN: | FileCheck %s
declare void @throw_exception()
|
7579839 to
b0f2c48
Compare
lenary
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit worries that this is the sort of place where a) big-endian data vs little-endian instructions will be a problem, and b) if we're using LLVM to both read and write in the test, and it is getting endianness wrong, then we won't necessarily see the issue in tests.
Have you separately cross-verified the reading and writing of dwarf data against binutils?
Yes, I checked it and it works. I am not sure if it can be incorporated into the llvm's testing infra somehow... |
lenary
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I don't think we should extend LLVM's in-tree tests with testing against gcc etc, I am happy to trust your confirmation that things were working together.
Thanks! |
Add DWARF exception handling support for riscv big-endian targets. More CodeGen changes related to riscvbe are coming.
1e58918 to
d22a2f2
Compare
Add DWARF exception handling support for riscv big-endian targets.
More CodeGen changes related to riscvbe are coming.